# DrawSquare.py # # Description: Draws a square with a Turtle # given a colour and the size of the square's sides. # # Anne Lavergne # Date: Feb. 12 2024 # Import the turtle library import turtle def drawSquare(aColour, aSideSize): """Draw a square of colour "aColour" and of side "sideSize".""" # Set the turtle's pen (tail) to "aColour" tt.color(aColour) # Tell the turtle to draw four sides # starting with the turtle facing east at (0,0) for side in range(4): # 0,1,2,3 tt.forward(aSideSize) tt.left(90) return # ***Main part of the program # Creates a graphics window "canvas" canvas = turtle.Screen() # Give a background colour to "canvas" canvas.bgcolor("yellow") # Create a turtle named "tt" tt = turtle.Turtle() # Set the colour of the square. theColour = "hotpink" # Set the size of the square. theSizeOfSide = 150 # Tell tt to draw a square of "theColour" and of "theSizeOfSide" drawSquare(theColour, theSizeOfSide) # Clock on canvas to exit canvas.exitonclick()